<script>
	import {
		init
	} from "@/ljshop";
	// #ifdef APP-PLUS
	   import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update.js'
	//  #endif
  
	export default {
       onShow(){
			uni.hideTabBar();
			// uni.loadFontFace({
			// 	family: 'myFont',
			// 	source: 'url("https://zh69xx.oss-cn-beijing.aliyuncs.com/app/date/2023/tff/PINGFANG%20REGULAR_0.TTF")',
			// 	success() {}
			// })
       },
		onLaunch(options) {
			// 存入注册推荐code
			if(options.query.ids){
				uni.setStorageSync('formCode',options.query.ids)
			}
			init(options);
			// 存入分享信息
			uni.setStorageSync("beiinvcode",options.query.InvitationCode)
			uni.setStorageSync("shareUId",options.query.shareUId)
			uni.setStorageSync("productId",options.query.productId)
			// 开启定向推送
			uni.setStorageSync("opents",1)
			// APP更新
			// #ifdef APP-PLUS
			  checkUpdate();
			//  #endif
			// 微信小程序更新
			// #ifdef MP-WEIXIN
			const updateManager  = uni.getUpdateManager()
			 updateManager.onCheckForUpdate(res => {
			    if(res.hasUpdate) {
			      uni.showModal({
			        content: '新版本已经准备好，是否重启应用？',
			        showCancel: false,
			        confirmText: '确定',
			        success: res => {
			          if (res.confirm) {
			            updateManager.onUpdateReady(res => {
			              updateManager.applyUpdate()
			            })
			            updateManager.onUpdateFailed(res => {
			              uni.showModal({
			                content: '下载失败，请删除当前小程序后重新打开',
			                showCancel: false,
			                confirmText: '知道了'
			              })
			            })
			          }
			        }
			      })
			    }
			  })
			// #endif
		}
	};
</script>

<style lang="scss">
	// #ifndef APP-PLUS-NVUE
	@import 'static/style/index.scss';
	@import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
	//#endif
	
	.upward {
		width: 70rpx;
		height: 70rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 100%;
		border: 1rpx solid #d0d0d0;
		margin-bottom: 20rpx;
		background-color: rgba(255, 255, 255, 0.9);
		position: fixed;
		bottom: 300rpx;
		right: 30rpx;
		z-index: 100;
	}
	
	.upward {
		-webkit-animation: fadeInRightBig 1s .2s ease both;
		-moz-animation: fadeInRightBig 1s .2s ease both;
	}
	@-webkit-keyframes fadeInRightBig {
		0% {
			opacity: 0;
			-webkit-transform: translateX(1000px)
		}
		100% {
			opacity: 1;
			-webkit-transform: translateX(0)
		}
	}
	@-moz-keyframes fadeInRightBig {
		0% {
			opacity: 0;
			-moz-transform: translateX(1000px)
		}
		100% {
			opacity: 1;
			-moz-transform: translateX(0)
		}
	}
</style>
